package com.crane.oss.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * 学段-2
 *
 * @author tyh
 *
 */
public enum SectionEnum {
    /**
     *
     */
    PRIMARY_SCHOOL(1, "小学","xd0"),

    JUNIOR_HIGH_SCHOOL(2, "初中","xd1"),

    HIGH_SCHOOL(4, "高中","xd2");

    private Integer type;

    private String remark;

    private String alias;

    private SectionEnum(Integer type, String remark,String alias) {
        this.type = type;
        this.remark = remark;
        this.alias=alias;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public static String getRemarkByType(Integer type){
        for(SectionEnum sectionEnum : SectionEnum.values()){
              if(sectionEnum.getType().equals(type)){
                  return  sectionEnum.getRemark();
              }
        }
        return "";
    }
    
    public static String getRemarkByAlias(String alias){
        for(SectionEnum sectionEnum : SectionEnum.values()){
              if(sectionEnum.getAlias().equals(alias)){
                  return  sectionEnum.getRemark();
              }
        }
        return "";
    }

    public static String getAlias(Integer type){
        for(SectionEnum sectionEnum : SectionEnum.values()){
            if(sectionEnum.getType().equals(type)){
                return  sectionEnum.getAlias();
            }
        }
        return "";
    }

    public static SectionEnum getSectionEnum(Integer type){
        for(SectionEnum sectionEnum : SectionEnum.values()){
            if(sectionEnum.getType().equals(type)){
                return  sectionEnum;
            }
        }
        return null;
    }


    public static List<GradeEnum> getGradeEnum(SectionEnum schoolSystemEnum){
        List<GradeEnum> result=new ArrayList<>();
        switch (schoolSystemEnum){
            case PRIMARY_SCHOOL:
                result.add(GradeEnum.Grade_First);
                result.add(GradeEnum.Grade_Second);
                result.add(GradeEnum.Grade_Third);
                result.add(GradeEnum.Grade_Fourth);
                result.add(GradeEnum.Grade_Five);
                result.add(GradeEnum.Grade_Six);
                break;
            case JUNIOR_HIGH_SCHOOL:
                result.add(GradeEnum.Grade_Seven);
                result.add(GradeEnum.Grade_Eight);
                result.add(GradeEnum.Grade_Nine);
                break;
            case HIGH_SCHOOL:
                result.add(GradeEnum.Grade_high_First);
                result.add(GradeEnum.Grade_high_Second);
                result.add(GradeEnum.Grade_high_Third);
                break;
            default:
        }
        return result;
    }
    
    public static void main(String[] args) {
		System.out.println(SectionEnum.getAlias(1));
		System.out.println(SectionEnum.getRemarkByAlias("xd0"));
	}

}
